package com.summer.Thread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

class NumberThread implements Runnable{
    @Override
    public void run() {
        for (int i = 1; i <= 100 ; i++) {
            if (i%2==0){
                System.out.println(i);
            }
        }
    }
}

public class ThreadPool {
    public static void main(String[] args) {
        ExecutorService service = Executors.newFixedThreadPool(10);
        //ThreadPoolExecutor service1 = (ThreadPoolExecutor)service;
//        service1.setCorePoolSize();
//        service1.setKeepAliveTime();
        service.execute(new NumberThread());//适合用于Runnable
       // service.submit();//适合用于Callable;
        service.shutdown();
    }
}
